#Variables
CC=gcc

EXE=tower
FILES= astar game towers ennemies mouvement sdl_print wm matrices wave\
      screens collide astar_lnklist

CFLAGS=-Wall -Wextra -Werror -std=c99 -pedantic #-g -ggdb3 -O3 -DDEBUG
LDFLAGS=-lm -lSDL `sdl-config --cflags --libs` -L../../libs -lSDL_image\
		-lSDL_ttf

SRC_FOLDER=.
OBJ_FOLDER=objs
BIN_FOLDER=../../bin

EXEC=$(BIN_FOLDER)/$(EXE)

OBJS_FULL=$(addprefix $(OBJ_FOLDER)/, $(FILES))
OBJS=$(addsuffix .o, $(OBJS_FULL))

.PHONY : clean distclean

all : $(EXEC)

$(EXEC) : $(OBJS)
	mkdir -p $(BIN_FOLDER)
	$(CC) $(LDFLAGS) -o $@ $^

$(OBJ_FOLDER)/%.o : $(SRC_FOLDER)/%.c
	mkdir -p $(OBJ_FOLDER)
	$(CC) -o $@ -c $< $(CFLAGS)

clean:
	rm -rf $(OBJ_FOLDER)

distclean:
	rm -f $(EXEC)
